package com.coder4j.auth.mapper;

import com.coder4j.starter.mybatis.BaseMapper;
import com.coder4j.auth.entity.AuthUserEntity;
import org.apache.ibatis.annotations.Mapper;

import java.util.Arrays;
import java.util.List;

/**
 * 用户
 *
 * @author keller
 * @date 2024-05-07 18:10:11
 */
@Mapper
public interface AuthUserMapper extends BaseMapper<AuthUserEntity> {
    /**
     * 默认查询条件
     *
     * @return
     */


    @Override
    default List<String> defaultCondition() {
        return Arrays.asList(
                " <if test = 'createId!=null'> AND create_id=#{createId} </if>",
                " <if test = 'updateId!=null'> AND update_id=#{updateId} </if>",
                " <if test = 'accountNo!=null'> AND account_no=#{accountNo} </if>",
                baseLikeCondition("user_name"),
                " <if test = 'email!=null'> AND email=#{email} </if>",
                " <if test = 'phone!=null'> AND phone=#{phone} </if>",
                " <if test = 'roleId!=null'> AND role_id=#{roleId} </if>",
                " <if test = 'organizationId!=null'> AND organization_id=#{organizationId} </if>"
        );
    }
}
